package drawing;

import java.awt.*;

// Homework 11 written by Mladen Yakimov (GTID: 902575580)
// Collaboration Statement:
// I did not discuss this assignment with anyone.

/**
* @author Mladen Yakimov
* This is HW11
* This class is the Circle class, a subclass of MovableShape
*/

public class Circle extends MovableShape {
	private Point orbitPoint;
	private int radius;
	private int orbitRadius;
	private double theta;
	private double deltaTheta;

   /**
   * This is the circle constructor
   * @param x x-position
   * @param y y-position
   * @param radius the circle radius
   * @param orbitRadius the radius of the circle orbit
   * @param deltaTheta the rate at which theta changes
   */
	public Circle(int x, int y, int radius, int orbitRadius, double deltaTheta) {
		//height and width are the diameter (2*radius)
		super(x,y,2*radius,2*radius);
		orbitPoint = new Point(x,y);
		this.orbitRadius = orbitRadius;
		this.deltaTheta = (Math.PI/180)*deltaTheta;
		//initialize theta with a value of 0
		theta = 0;
	}

   /**
   * This is the move method for the Circle class
   * It moves the circle according to the deltaTheta and goes around in a radius
   */
	public void move() {
		theta = theta + deltaTheta;
		x = (int) (orbitPoint.getX() + orbitRadius*Math.cos(theta));
		y = (int) (orbitPoint.getY() + orbitRadius*Math.sin(theta));

	}

   /**
   * This method draws the Circle
   * @param g the graphics object to draw the Circle
   */
	public void draw(Graphics g) {
		g.drawOval(x,y, width, height);
	}


}
